from django.conf.urls.defaults import *
import views


###############################################################################
urlpatterns = patterns('tasks',
    url(r'^$', views.home, name="tasks"),
    url(r'^admin$', views.manage_tasks, name="manage_tasks"),
    url(r'^admin/(?P<task_pk>\d+)/assign$',
        views.manage_assign_tasks,
        name="manage_assign_tasks"),
    url(r'^admin/(?P<task_pk>\d+)/assign/email$',
        views.manage_assign_email,
        name="manage_assign_email"),
    url(r'^admin/queue$',
        views.scan_queue,
        name="scan_email_queue"),
    url(r'^admin/assign_constituencies$',
        views.admin_assign_constituency,
        name="admin_assign_constituency"),

    url(r'^(?P<taskuser_id>\d+)/(?P<taskemail_id>\d+)/spacer.gif$',
        views.open_email,
        name="open_email"),

    url(r'^(?P<slug>[\w-]+)/constituency/(?P<constituency>[\w-]+)/start/(?P<login_key>[\w-]+)/$',
        views.start_task,
        name="start_task"),
    url(r'^(?P<slug>[\w-]+)/constituency/(?P<constituency>[\w-]+)/start$',
        views.start_task,
        name="start_task"),
    url(r'^(?P<slug>[\w-]+)/start/(?P<login_key>[\w-]+)/$',
        views.start_task,
        name="start_task"),
    url(r'^(?P<slug>[\w-]+)/start$',
        views.start_task,
        name="start_task"),

    url(r'^(?P<slug>[\w-]+)/constituency/(?P<constituency>[\w-]+)/complete$',
        views.complete_task,
        name="complete_task"),
    url(r'^(?P<slug>[\w-]+)/constituency/(?P<constituency>[\w-]+)/complete/(?P<login_key>[\w-]+)/$',
        views.complete_task,
        name="complete_task"),
    url(r'^(?P<slug>[\w-]+)/complete/(?P<login_key>[\w-]+)/$',
        views.complete_task,
        name="complete_task"),
    url(r'^(?P<slug>[\w-]+)/complete/$',
        views.complete_task,
        name="complete_task"),

    url(r'^(?P<slug>[\w-]+)/ignore/$',
        views.ignore_task,
        name="ignore_task"),
    url(r'^(?P<slug>[\w-]+)/constituency/(?P<constituency>[\w-]+)/ignore$',
        views.ignore_task,
        name="ignore_task"),
    url(r'^(?P<slug>[\w-]+)/ignore/(?P<login_key>[\w-]+)/$',
        views.ignore_task,
        name="ignore_task"),
    url(r'^(?P<slug>[\w-]+)/constituency/(?P<constituency>[\w-]+)/ignore/(?P<login_key>[\w-]+)/$',
        views.ignore_task,
        name="ignore_task"),

    url(r'^(?P<slug>[\w-]+)/unignore/$',
        views.unignore_task,
        name="unignore_task"),
    url(r'^(?P<slug>[\w-]+)/unignore/constituency/(?P<constituency>[\w-]+)$',
        views.unignore_task,
        name="unignore_task"),

    url(r'^(?P<slug>[\w-]+)/(?P<login_key>[\w-]+)$',
        views.task,
        name="task"),
    url(r'^(?P<slug>[\w-]+)/constituency/(?P<constituency>[\w-]+)/(?P<login_key>[\w-]+)/$',
        views.task,
        name="task"),
    url(r'^(?P<slug>[\w-]+)$',
        views.task,
        name="task"),
    url(r'^(?P<slug>[\w-]+)/constituency/(?P<constituency>[\w-]+)$',
        views.task,
        name="task"),
)
